package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.SmsSendBlackRecordMapper;
import com.ybkj.daijia.server.model.SmsSendBlackRecord;
import com.ybkj.daijia.server.service.SmsSendBlackRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 */
@Service
public class DefaultSmsSendBlackRecordService implements SmsSendBlackRecordService {

    @Autowired
    private SmsSendBlackRecordMapper smsSendBlackRecordMapper;

    @Transactional(rollbackFor = Exception.class)
    public void save(SmsSendBlackRecord smsSendBlackRecord) {

        smsSendBlackRecordMapper.insertRecord(smsSendBlackRecord);

    }

    public SmsSendBlackRecord findByPhoneAndIp(String IP, String phone) {

        return smsSendBlackRecordMapper.selectByPhoneAndIp(IP, phone);
    }

    @Transactional(rollbackFor = Exception.class)
    public void deleteByPhone(String phone) {

        smsSendBlackRecordMapper.deleteByPhone(phone);
    }

    @Transactional(rollbackFor = Exception.class)
    public void update(SmsSendBlackRecord smsSendBlackRecord) {

        smsSendBlackRecordMapper.updateByPrimaryKey(smsSendBlackRecord);
    }


}
